package com.jyh.homework.t4;

import java.io.Serial;
import java.io.Serializable;

/**
 * @Author JYH
 * @Date 2024/8/6 18:42
 * @Description
 */
public class Message implements Serializable {
    @Serial
    private static final long serialVersionUID = 2873312360116513244L;
    private String faName;//发送者
    private String shouName;//接收者
    private String message;//消息内容
    private String time;//发送时间

    public Message() {
    }

    public Message(String faName, String shouName, String message, String time) {
        this.faName = faName;
        this.shouName = shouName;
        this.message = message;
        this.time = time;
    }

    public String getFaName() {
        return faName;
    }

    public void setFaName(String faName) {
        this.faName = faName;
    }

    public String getShouName() {
        return shouName;
    }

    public void setShouName(String shouName) {
        this.shouName = shouName;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Message message1 = (Message) o;

        if (faName != null ? !faName.equals(message1.faName) : message1.faName != null) return false;
        if (shouName != null ? !shouName.equals(message1.shouName) : message1.shouName != null) return false;
        if (message != null ? !message.equals(message1.message) : message1.message != null) return false;
        return time != null ? time.equals(message1.time) : message1.time == null;
    }

    @Override
    public int hashCode() {
        int result = faName != null ? faName.hashCode() : 0;
        result = 31 * result + (shouName != null ? shouName.hashCode() : 0);
        result = 31 * result + (message != null ? message.hashCode() : 0);
        result = 31 * result + (time != null ? time.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Message{" +
                "faName='" + faName + '\'' +
                ", shouName='" + shouName + '\'' +
                ", message='" + message + '\'' +
                ", time='" + time + '\'' +
                '}';
    }
}
